package com.ftg.learn.bus.menu.menu_mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ftg.learn.bus.menu.menu_pojo.menu_admin;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface menu_admin_mapper extends BaseMapper<menu_admin> {

    @Select("select a.*,b.menu_id as 父级菜单id,b.menu_name as 父级菜单名 from " +
            "menu_admin a left join menu_admin b on a.menu_father=b.menu_id")
    List<Map<String,Object>> querMenu();

    @Delete("<script>delete from menu_admin where menu_id in" +
                "<foreach collection='menu_ids'  item='item' open='(' separator=',' close=')'  >" +
                      "#{item}" +
                "</foreach>" +
            "</script>")
    int deleteMenuForRole(List<Integer> menu_ids);
}
